package com.dehui.traders.ui.viewmodle;

import android.content.Context;

import com.dehui.traders.bean.ConstantTest;
import com.dehui.traders.kchart.DataParse;
import com.dehui.traders.kchart.MyCombinedChartX;
import com.dehui.traders.kchart.PriceManager;

import org.json.JSONException;
import org.json.JSONObject;

import me.goldze.mvvmhabit.base.BaseViewModel;

/**
 * Created by hqq on 18.4.19.
 */

public class FreightSpaceViewModel extends BaseViewModel{


    private DataParse mData;

    public FreightSpaceViewModel(Context context) {
        super(context);
    }

    public void initChart(MyCombinedChartX chartX) {
        getOffLineData();
        PriceManager.getInstange().initPrice(context,chartX, mData);
    }

    private void getOffLineData() {
           /*方便测试，加入假数据*/
        mData = new DataParse();
        JSONObject object = null;
        try {
            object = new JSONObject(ConstantTest.MINUTESURL);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        mData.parseMinutes(object);
    }

}
